feat(options): Implement user option to toggle Right Mouse Scroll with Alternate Mouse#2798
Conversation
… with Alternate Mouse Toggle with UseRightMouseScrollWithAlternateMouse=yes/no in Options.ini
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Include/Common/OptionPreferences.h | Adds getRightMouseScrollWithAlternateMouseEnabled() const declaration; correctly mirrors the pattern of surrounding methods. |
| Core/GameEngine/Source/Common/OptionPreferences.cpp | Implements the new preference getter; falls back to TheGlobalData->m_useRightMouseScrollWithAlternateMouse when key is absent, consistent with neighbouring getters. |
| Generals/Code/GameEngine/Include/Common/GlobalData.h | Adds m_useRightMouseScrollWithAlternateMouse field, addressing the missing-field compilation issue noted in a prior review thread. |
| Generals/Code/GameEngine/Source/Common/GlobalData.cpp | Initialises the new field in the constructor (default FALSE via #if RTS_GENERALS); the historical attribution comment carries a pre-2026 date in newly added code. |
| Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp | Persists the INI value on every options-save so it isn't clobbered; no UI widget yet (gated with @todo). |
| Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp | Adds userWantsRMBScroll guard before setScrolling(SCROLL_RMB); logic correctly allows RMB scroll when not in alternate-mouse mode or when the new flag permits it. |
| GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h | Mirrors the Generals header change; adds m_useRightMouseScrollWithAlternateMouse in the correct position. |
| GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp | Same constructor block as the Generals copy (including the pre-2026 attribution comment); the #if RTS_GENERALS dead-code issue was noted in a prior thread and is deferred. |
| GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp | Identical pattern to the Generals OptionsMenu change; correctly preserves the setting on save. |
| GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp | Mirrors the Generals LookAtXlat.cpp change; RMB scroll guard logic is identical and correct. |
Sequence Diagram
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant INI as Options.ini
participant OP as OptionPreferences
participant GD as GlobalData
participant LX as LookAtXlat
participant OM as OptionsMenu (saveOptions)
Note over GD: Constructor sets default<br/>Generals: FALSE<br/>ZeroHour: TRUE
GD->>OP: parseGameDataDefinition calls getRightMouseScrollWithAlternateMouseEnabled()
OP->>INI: find("UseRightMouseScrollWithAlternateMouse")
alt key present
INI-->>OP: "yes"/"no"
OP-->>GD: TRUE / FALSE
else key absent
OP-->>GD: m_useRightMouseScrollWithAlternateMouse (default)
end
Note over GD: m_useRightMouseScrollWithAlternateMouse set
LX->>GD: read m_useAlternateMouse + m_useRightMouseScrollWithAlternateMouse
LX->>LX: "userWantsRMBScroll = !useAlt || useRMBWithAlt"
alt "userWantsRMBScroll && !isSelecting && !isScrolling"
LX->>LX: setScrolling(SCROLL_RMB)
end
OM->>OP: getRightMouseScrollWithAlternateMouseEnabled()
OP-->>OM: current value
OM->>INI: write "UseRightMouseScrollWithAlternateMouse"
OM->>GD: update m_useRightMouseScrollWithAlternateMouse
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant INI as Options.ini
participant OP as OptionPreferences
participant GD as GlobalData
participant LX as LookAtXlat
participant OM as OptionsMenu (saveOptions)
Note over GD: Constructor sets default<br/>Generals: FALSE<br/>ZeroHour: TRUE
GD->>OP: parseGameDataDefinition calls getRightMouseScrollWithAlternateMouseEnabled()
OP->>INI: find("UseRightMouseScrollWithAlternateMouse")
alt key present
INI-->>OP: "yes"/"no"
OP-->>GD: TRUE / FALSE
else key absent
OP-->>GD: m_useRightMouseScrollWithAlternateMouse (default)
end
Note over GD: m_useRightMouseScrollWithAlternateMouse set
LX->>GD: read m_useAlternateMouse + m_useRightMouseScrollWithAlternateMouse
LX->>LX: "userWantsRMBScroll = !useAlt || useRMBWithAlt"
alt "userWantsRMBScroll && !isSelecting && !isScrolling"
LX->>LX: setScrolling(SCROLL_RMB)
end
OM->>OP: getRightMouseScrollWithAlternateMouseEnabled()
OP-->>OM: current value
OM->>INI: write "UseRightMouseScrollWithAlternateMouse"
OM->>GD: update m_useRightMouseScrollWithAlternateMouse
Reviews (2): Last reviewed commit: "Replicate in Generals" | Re-trigger Greptile
|
Replicated in Generals with conflicts |
This change adds a user option to enable or disable Right Mouse Scroll with Alternate Mouse. It can be toggled with
UseRightMouseScrollWithAlternateMouse=yes/noin the Options.iniThe reason for this option is that before merge #2794 the RMB scroll was disabled in Generals, but enabled in Zero Hour. It is now default disabled in Generals and default enabled in Zero Hour, but both games can toggle it. This avoids potential irritations for legacy Generals players with Alternate Mouse setup.
TODO